//arrobj.cpp -- functions with array objects
#include <iostream>
#include <string>
const int Seasons = 4;
const char* Snames[Seasons] = {"spring","summer","fall","winter"};
struct expenses
{
    double expen[Seasons];
};

void fill(expenses* ex);
void show(expenses ex);
int main()
{
    expenses ex;
    fill(&ex);
    show(ex);
    return 0;
}

void fill(expenses* ex)
{
    for (int i = 0; i < Seasons; i++)
    {
        std::cout << "Enter " << Snames[i] << " expenses: ";
        std::cin >> ex->expen[i];
    }
}

void show(expenses ex)
{
    double total = 0.0;
    std::cout << "\nEXPENSES\n";
    for (int i = 0; i < Seasons; i++)
    {
        std::cout << Snames[i] << ": $" << ex.expen[i] << '\n';
        total += ex.expen[i];
    }
    std::cout << "Total: $" << total << '\n';
}